#pragma once

#include "DX11Includes.h"
#include <gdiplus.h>
#pragma comment(lib, "gdiplus.lib")

class SpriteFont
{
public:

    enum FontStyle 
    {
        Regular = 0,
        Bold = 1 << 0,
        Italic = 1 << 1,
        BoldItalic = Bold | Italic,
        Underline = 1 << 2,
        Strikeout = 1 << 3
    };

    struct CharDesc
    {
        float X;        
        float Y;
        float Width;
        float Height;
    };

    static const WCHAR  StartChar = '!';
	static const WCHAR EndChar = 127;
    static const int NumChars = EndChar - StartChar;
    static const int TexWidth = 1024;

    SpriteFont();
    ~SpriteFont();

	bool Initialize(LPCWSTR fontName, float fontSize, int fontStyle, bool antiAliased);

    // Accessors    
    ID3D11ShaderResourceView* SRView() const;
    const CharDesc* CharDescriptors() const;
    const CharDesc& GetCharDescriptor(WCHAR character) const;
    float Size() const;
    ID3D11Texture2D* Texture() const;
    int TextureWidth() const;
    int TextureHeight() const;
    float SpaceWidth() const;
    float CharHeight() const;

protected:    

    ID3D11Texture2D* texture;
    ID3D11ShaderResourceView* srView;
    CharDesc charDescs [NumChars];
    float size;
    int texHeight;
    float spaceWidth;
    float charHeight;            
};


